package devbureau.fstore.test;

import static org.junit.Assert.fail;

import org.junit.Test;

import devbureau.fstore.common.Store;
import devbureau.fstore.common.StoreFactory;
import devbureau.fstore.common.StoreItemFilter;
import devbureau.fstore.common.StoreItemOrder;
import devbureau.fstore.common.StoreItemOrderDir;
import devbureau.fstore.common.StoreItemOrderField;


public class Filters {

    @Test
    public void storeSupplier() {
    	try {
			Store store = StoreFactory.getStore();
			String supplier = store.listSuppliers(new StoreItemFilter(true)).get(0);
			System.out.println("Filters.storeSupplier() supplier = " + supplier);
			StoreItemFilter filter = new StoreItemFilter(true);
			int totalCount = store.listItems(filter,new StoreItemOrder(StoreItemOrderField.PRICE_RUR,StoreItemOrderDir.asc)).size();
			System.out.println("Filters.storeSupplier() totalCount = " + totalCount);
//			filter.setSupplier(supplier);
//			int supplierCount = store.listItems(filter,new StoreItemOrder(StoreItemOrderField.PRICE_RUR,StoreItemOrderDir.asc)).size();
//			System.out.println("Filters.storeSupplier() supplierCount = " + supplierCount);
			filter.setName("UL");	
			int titleCount = store.listItems(filter,new StoreItemOrder(StoreItemOrderField.PRICE_RUR,StoreItemOrderDir.asc)).size();
			System.out.println("Filters.storeSupplier() titleCount = " + titleCount);

			
		} catch (Exception e) {
            fail("exception");
		}
    }
}
